<template>
  <div id="cart">
<!--    导航-->
    <nav-bar class="nav-bar">
      <div slot="center">购物车({{cartCount}})</div>
    </nav-bar>
<!--    列表-->
    <cart-list class="cart-list"></cart-list>
<!--    底部总结-->
    <bottom-bar></bottom-bar>
  </div>
</template>

<script>
import NavBar from "components/common/navbar/NavBar";
import CartList from './childComps/CartList'
import BottomBar from './childComps/BottomBar'

import {mapGetters} from 'vuex'

export default {
  name: "Cart",
  components: {
    NavBar,
    CartList,
    BottomBar
  },
  computed: {
    // 采用mapGetters方法
    // 用法1：传到列表中
    ...mapGetters(['cartCount'])
    // 用法2：传到对象中
    // ...mapGetters({
    //   length:'cartCount',
    //   list:'cartList'
    // })
  }
}
</script>

<style scoped>
#cart {
  /*position: relative;*/
  height: 100vh;
}

/*导航栏*/
.nav-bar {
  background-color: var(--color-tint);
  /*加粗*/
  font-weight: 700;
  color: #fff;
}

.cart-list {
  position: absolute;
  top: 44px;
  bottom: 93px;
  width: 100%;
  overflow: hidden;
}
</style>
